﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Winter.BackEnd.Models.Domain;

namespace Winter.BackEnd.Models.GoogleMaps
{
    public class MapRepository
    {
        public Map GetById(string buildingName)
        {
            Builging building = Repository.CurrentDataContext.Builgings.Single(b => b.BuildingName == buildingName);
            return new Map
            {
                Name = building.BuildingName,
                Zoom = 16,
                LatLng = new LatLng { Latitude = double.Parse(building.Latitude.Replace(".", ",")), Longitude = double.Parse(building.Longitude.Replace(".", ",")), },
                Locations =
                           {
                               new Location
                               {
                                   Name = building.Location,
                                   LatLng = new LatLng { Latitude = double.Parse(building.Latitude.Replace(".",",")), Longitude = double.Parse(building.Longitude.Replace(".",",")) },
                                   Image = "K1.jpg"
                               }
                           }
            };
        }
    }
}
